import axios from 'axios';

// 数据库连接测试 / 连接样本
export const dbConnTest = (callback)=>{
    axios.get(`/apis/dbconntest`).then(res=>{
        callback(res.data);
    }).catch(err => {
        console.log(err);
    });
}

// 获取验证码
export const getVerfityCode = (callback) => {
    axios.get(`/apis/getVerfityCode`).then(res => {
        callback(res.data);
    }).catch(err => {
        console.log(err)
    });
};

// 用户注册
export const register = (userInfo, callback) => {
    const config = {
        url: "/apis/register",
        method: "POST",
        data: userInfo,
    }
    axios(config).then(res => {
        callback(res.data);
    }).catch(err => {
        console.log(err)
    });
}

// 用户登录
export const login = (userInfo, callback) => {
    const config = {
        url: "/apis/login",
        // url: "/server/login",
        method: "POST",
        data: userInfo,
    }
    axios(config).then(res => {
        callback(res.data);
    }).catch(err => {
        console.log(err);
    });
}

// 图书信息发布
export const bookSellRelease = (bookInfo, callback)=>{
    callback({code:"06",msg:"test",data:bookInfo});
}
